//
//  NSDate+timestamp.h
//  helper
//
//  Created by huangyi on 12-10-29.
//  Copyright (c) 2012年 huangyi. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSDate (timestamp)

+(NSTimeInterval)timestamp;
+(NSDate*)dateFromRFC822String:(NSString*)dateString;
+(NSDate*)dateFromRFC3339String:(NSString*)dateString;

-(NSDate*)dateOfTomorrow;
-(NSDate*)dateOfYesterday;
-(BOOL)isToday;
-(BOOL)isYesterday;
-(BOOL)isTomorrow;

-(NSString*)stringWithFormat:(NSString*)format;
-(NSString*)stringWithFormat:(NSString*)format withLocale:(NSLocale*)locale;
-(NSString*)stringWithFormat:(NSString*)format withTimeZone:(NSTimeZone*)timezone;
-(NSString*)stringWithFormat:(NSString*)format withLocale:(NSLocale*)locale withTimeZone:(NSTimeZone*)timezone;

+(NSInteger)offsetOfTimeZone:(NSTimeZone*)timezone;
-(NSDate*)startOfDate;

-(NSString*)localizedStringWithFormat:(NSString*)format;

@end

extern int unixtime();
extern NSString* NOW();
extern NSDate* NSDateFromTimestamp(NSTimeInterval timestamp);
